Program structure: An example
Pascal C/C++
w#include <iostream.h>
w
wint main()
w{   //print a string
w  cout << “Hello, C++.\n”;
w}
w
wOR:     
wprintf(“Hello, C++.\n”);
program  ex(output);
begin
   (*print a string*)
    writeln(‘Hello, C++.’);
end.
Here is a program which will print out the message.

Hello, C++.

Note: Every C program contains a function called main. This is the start point of the program.

printf(“Hello, C++.\n”);
Prints the worlds on the screen. The text to be printed is enclosed in double quotes. The \n at the end of the text tells the program to print a newline as part of the output.

Most C programs are in lower case letters. You will usually find upper case letters used in preprocessor definitions or inside quotes as parts of character strings. C is case sensitive, that is, it recognises a lower case letter and it’s upper case equivalent as being different.